<!DOCTYPE html>
<html lang="en">
  <head>
    <title>InputBarAccessoryView  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset='utf-8'>
    <script src="js/jquery.min.js" defer></script>
    <script src="js/jazzy.js" defer></script>
    
  </head>
  <body>
    <a title="InputBarAccessoryView  Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="index.html">InputBarAccessoryView Docs</a> (65% documented)</p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="index.html">InputBarAccessoryView Reference</a>
        <img id="carat" src="img/carat.png" />
        InputBarAccessoryView  Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Classes/AttachmentCell.html">AttachmentCell</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/AttachmentCollectionView.html">AttachmentCollectionView</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/AttachmentManager.html">AttachmentManager</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/AttachmentManager/Attachment.html">– Attachment</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/AutocompleteCell.html">AutocompleteCell</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/AutocompleteManager.html">AutocompleteManager</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/AutocompleteSession.html">AutocompleteSession</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/AutocompleteTableView.html">AutocompleteTableView</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/ImageAttachmentCell.html">ImageAttachmentCell</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/InputBarAccessoryView.html">InputBarAccessoryView</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/InputBarButtonItem.html">InputBarButtonItem</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/InputBarButtonItem/Spacing.html">– Spacing</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/InputBarSendButton.html">InputBarSendButton</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/InputBarViewController.html">InputBarViewController</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/InputStackView.html">InputStackView</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/InputStackView/Position.html">– Position</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/InputTextView.html">InputTextView</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/KeyboardManager.html">KeyboardManager</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/SeparatorLine.html">SeparatorLine</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Enums.html">Enumerations</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Enums/KeyboardEvent.html">KeyboardEvent</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Extensions/NSAttributedString.html">NSAttributedString</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/NSAttributedString/Key.html">– Key</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Protocols/AttachmentManagerDataSource.html">AttachmentManagerDataSource</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/AttachmentManagerDelegate.html">AttachmentManagerDelegate</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/AutocompleteManagerDataSource.html">AutocompleteManagerDataSource</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/AutocompleteManagerDelegate.html">AutocompleteManagerDelegate</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/InputBarAccessoryViewDelegate.html">InputBarAccessoryViewDelegate</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/InputItem.html">InputItem</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Structs.html">Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Structs/AutocompleteCompletion.html">AutocompleteCompletion</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/HorizontalEdgePadding.html">HorizontalEdgePadding</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/KeyboardNotification.html">KeyboardNotification</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Typealiases.html">Type Aliases</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Typealiases.html#/s:21InputBarAccessoryView011AttachmentsD0a">AttachmentsView</a>
              </li>
              <li class="nav-group-task">
                <a href="Typealiases.html#/s:21InputBarAccessoryView0A7Managera">InputManager</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            
            <p><a href=""><img src="./Screenshots/Preview.gif" alt="Image"></a></p>
<h1 id='inputbaraccessoryview' class='heading'>InputBarAccessoryView</h1>
<h3 id='features' class='heading'>Features</h3>

<ul>
<li>[x] Autocomplete text with @mention, #hashtag or any other prefix</li>
<li>[x] A self-sizing <code>UITextView</code> with an optional fixed height (can be replaced with any other view)</li>
<li>[x] Image paste support<br></li>
<li>[x] Autocomplete attributed text highlighting</li>
<li>[x] Reactive components that respond to given events</li>
<li>[x] Top/Bottom/Left/Right <code><a href="Classes/InputStackView.html">InputStackView</a></code>s that act as toolbars to place buttons</li>
<li>[x] <code>RxSwift</code>/<code>RxCocoa</code> Support</li>
<li>[x] Drop in attachment view for file/photo management</li>
<li>[x] Plugin support for your own <code>InputPlugin</code>s</li>
<li>[x] Compatible with all iPhones and iPads</li>
<li>[x] RTL Support</li>
</ul>
<h3 id='installation-via-cocoapods' class='heading'>Installation via CocoaPods</h3>
<pre class="highlight ruby"><code><span class="c1"># Swift 5.0</span>
<span class="n">pod</span> <span class="s1">'InputBarAccessoryView'</span>
<span class="c1"># Swift 4.2</span>
<span class="n">pod</span> <span class="s1">'InputBarAccessoryView'</span><span class="p">,</span> <span class="s1">'4.2.2'</span>
</code></pre>
<h3 id='installation-via-carthage' class='heading'>Installation via Carthage</h3>
<pre class="highlight ruby"><code><span class="c1"># Swift 5.0</span>
<span class="n">github</span> <span class="s2">"nathantannar4/InputBarAccessoryView"</span>
<span class="c1"># Swift 4.2</span>
<span class="n">github</span> <span class="s2">"nathantannar4/InputBarAccessoryView"</span> <span class="s2">"4.2.2"</span>
</code></pre>
<h3 id='requirements' class='heading'>Requirements</h3>

<p>iOS 9.0+
Swift 5.0</p>

<blockquote>
<p>The latest Swift 4.2 release is v4.2.2 </p>
</blockquote>
<h3 id='documentation' class='heading'>Documentation</h3>

<p><a href="./GETTING_STARTED.md">Getting Started</a></p>

<blockquote>
<p>See the Example project to see how you can make the iMessage, Slack, Facebook and GitHawk input bars!</p>
</blockquote>
<h3 id='example-usage' class='heading'>Example Usage</h3>

<p><img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotA.png" width="242" height="432"> <img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotB.png" width="242" height="432"> <img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotC.png" width="242" height="432"> <img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotD.png" width="242" height="432"> <img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotE.png" width="242" height="432"> <img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotF.png" width="242" height="432"></p>
<h3 id='featured-in' class='heading'>Featured In</h3>

<p>Add your app to the list of apps using this library and make a pull request.</p>

<ul>
<li><p><a href="https://github.com/MessageKit/MessageKit">MessageKit</a> <em>(renamed to MessageInputBar)</em></p>

<p>
<img src="https://raw.githubusercontent.com/MessageKit/MessageKit/master/Assets/mklogo.png" title="MessageKit Logo" height="50">
</p></li>
<li><p><a href="https://github.com/GitHawkApp/MessageViewController">MessageViewController</a> <em>(Autocomplete Highlighting Algorithm)</em></p>

<p>
<img src="https://avatars3.githubusercontent.com/u/32285710?s=200&v=4" title="GitHawk Logo" height="50">
</p></li>
</ul>
<h3 id='see-also' class='heading'>See Also</h3>

<p>iMessage style <a href="https://github.com/nathantannar4/TypingIndicator">TypingIndicator</a> for chat apps</p>
<h2 id='latest-releases' class='heading'>Latest Releases</h2>

<ul>
<li>5.0.0

<ul>
<li>Swift 5 support</li>
</ul></li>
<li>4.2.2

<ul>
<li>Fixed image paste orientation issue in <code><a href="Classes/InputTextView.html">InputTextView</a></code></li>
</ul></li>
<li>4.2.1

<ul>
<li>Fixed autocompletes of completions that contain spaces</li>
<li>Depricated <code>isCaseSensitive</code> in favor of a function asignment to pre-process autocompletions</li>
</ul></li>
<li>4.2.0

<ul>
<li>Added new API for overriding the main middle view, normally the <code><a href="Classes/InputTextView.html">InputTextView</a></code> so it can be replaced with views such as a <q>Join</q> button&quot;, <code>setMiddleContentView(_ view: UIView?, animated: Bool)</code></li>
</ul></li>
<li>4.1.2
    - Add RxSwift/RxCocoa support through extensions and delegate proxies in <code>RxInputBarAccessoryView</code>, requires <code>RxSwift</code> and <code>RxCocoa</code>
    - Add <code><a href="Classes/InputBarViewController.html">InputBarViewController</a></code> which contains an <code><a href="Classes/InputBarAccessoryView.html">InputBarAccessoryView</a></code> as the <code>inputAccessoryView</code> by default with a convenient <code>isInputBarHidden: Bool</code> property to show/hide it</li>
<li>4.1.1
    - Add <code>frameInsets: HorizontalEdgePadding</code> property to <code><a href="Classes/InputBarAccessoryView.html">InputBarAccessoryView</a></code> to inset the view to be compatible with <code>UISplitViewController</code> or other custom containers where the view should not be the full width</li>
<li>4.1.0
    - Fix issue where setting long strings in <code>viewDidLoad</code> broke inital layout, Issue #41
    - Add <code>deleteCompletionByParts: Bool</code> flag to <code><a href="Classes/AutocompleteManager.html">AutocompleteManager</a></code> to allow for partial deletions of autocompletes rather than just the entire substring. 
    - Add <code><a href="Classes/InputBarSendButton.html">InputBarSendButton</a></code> to use as the <code>sendButton</code> in <code><a href="Classes/InputBarAccessoryView.html">InputBarAccessoryView</a></code>. This subclass of <code><a href="Classes/InputBarButtonItem.html">InputBarButtonItem</a></code> has a <code>UIActivityIndicatorView</code> to show a spinner when making HTTP requests</li>
</ul>
<h3 id='a-href-changelog-md-changelog-a' class='heading'><a href="./CHANGELOG.md">CHANGELOG</a></h3>

<p><strong>Find a bug? Open an issue!</strong></p>
<h2 id='layout' class='heading'>Layout</h2>

<p>The layout of the <code><a href="Classes/InputBarAccessoryView.html">InputBarAccessoryView</a></code> is made of of 4  <code><a href="Classes/InputStackView.html">InputStackView</a></code>&lsquo;s and an <code><a href="Classes/InputTextView.html">InputTextView</a></code>. The padding of the subviews can be easily adjusted by changing the <code>padding</code> and <code>textViewPadding</code> properties. The constraints will automatically be updated.</p>

<p><img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/Layout.png"></p>

<p>It is important to note that each of the <code><a href="Classes/InputStackView.html">InputStackView</a></code>&rsquo;s to the left and right of the <code><a href="Classes/InputTextView.html">InputTextView</a></code> are anchored by a width constraint. This way the <code><a href="Classes/InputTextView.html">InputTextView</a></code> will always fill the space inbetween in addition to providing methods that can easily be called to hide all buttons to the right or left of the <code><a href="Classes/InputTextView.html">InputTextView</a></code> by setting the width constraint constant to 0. The bottom and top stack views are not height constraint and rely on their <code>intrinsicContentSize</code></p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">setLeftStackViewWidthConstant</span><span class="p">(</span><span class="n">to</span> <span class="nv">newValue</span><span class="p">:</span> <span class="kt">CGFloat</span><span class="p">,</span> <span class="nv">animated</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span>

<span class="kd">func</span> <span class="nf">setRightStackViewWidthConstant</span><span class="p">(</span><span class="n">to</span> <span class="nv">newValue</span><span class="p">:</span> <span class="kt">CGFloat</span><span class="p">,</span> <span class="nv">animated</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span>
</code></pre>
<h3 id='reactive-hooks' class='heading'>Reactive Hooks</h3>

<p>Each <code><a href="Classes/InputBarButtonItem.html">InputBarButtonItem</a></code> has properties that can hold actions that will be executed during various hooks such as the button being touched, the <code>UITextView</code>text changing and more! Thanks to these easy hooks with a few lines of code the items can be easily resized and animated similar to that of the Facebook messenger app.</p>
<pre class="highlight swift"><code><span class="c1">// MARK: - Hooks</span>

<span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">InputBarButtonItemAction</span> <span class="o">=</span> <span class="p">((</span><span class="kt">InputBarButtonItem</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span>    

<span class="kd">private</span> <span class="k">var</span> <span class="nv">onTouchUpInsideAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onKeyboardEditingBeginsAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onKeyboardEditingEndsAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onKeyboardSwipeGestureAction</span><span class="p">:</span> <span class="p">((</span><span class="kt">InputBarButtonItem</span><span class="p">,</span> <span class="kt">UISwipeGestureRecognizer</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onTextViewDidChangeAction</span><span class="p">:</span> <span class="p">((</span><span class="kt">InputBarButtonItem</span><span class="p">,</span> <span class="kt">InputTextView</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onSelectedAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onDeselectedAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onEnabledAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onDisabledAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
</code></pre>
<h2 id='author' class='heading'>Author</h2>

<p>
    <img src="https://github.com/nathantannar4/NTComponents/raw/master/NTComponents/Assets/Nathan.png" width="100" height="100">
</p>

<p><strong>Nathan Tannar</strong> - <a href="https://nathantannar.me">https://nathantannar.me</a></p>
<h2 id='license' class='heading'>License</h2>

<p>Distributed under the MIT license. See <code>LICENSE</code> for more information.</p>

          </section>
        </section>
        <section id="footer">
          <p>&copy; 2019 <a class="link" href="https://github.com/nathantannar4/InputBarAccessoryView" target="_blank" rel="external">Nathan Tannar</a>. All rights reserved. (Last updated: 2019-06-01)</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>
